package com.yanfan.energy.domain.enums;

/**
 * @Author huan
 * @Description 生产管理-批次状态
 * @ClassName 2023年01月09日 14:27:00
 * @Version 1.0
 **/
public enum BatchesStatus {

    PENDING(1, "待处理"), IN_PRODUCTION(2, "生产中"), FINISHED(3, "已完成");


    private Integer code;

    private String desc;

    BatchesStatus(Integer code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    /**
     * 根据枚举type 返回String类型
     *
     * @param type
     * @return
     */
    public static BatchesStatus getEnumByType(Integer type) {
        for (BatchesStatus item : BatchesStatus.values()) {
            if (item.getCode().equals(type)) {
                return item;
            }
        }
        throw new RuntimeException("通过type获取枚举类时出现异常！");
    }

    public Integer getCode() {
        return code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }


}
